

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>

<html>
<head>
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/foro/style-foro.css" />


<script src="${pageContext.request.contextPath}/Js/cargaCop/assets/js/jquery.knob.js"></script>

		<!-- jQuery File Upload Dependencies -->
		<script src="${pageContext.request.contextPath}/Js/cargaCop/assets/js/jquery.ui.widget.js"></script>
		<script src="${pageContext.request.contextPath}/Js/cargaCop/assets/js/jquery.iframe-transport.js"></script>
		<script src="${pageContext.request.contextPath}/Js/cargaCop/assets/js/jquery.fileupload.js"></script>
		
		<!-- Our main JS file -->
		<script src="${pageContext.request.contextPath}/Js/cargaCop/assets/js/script.js"></script>

<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/Js/cargaCop/assets/css/style.css" />

<script type="text/javascript">

$("#uploadFileForo").submit(function(e)
		{
//			 	var nameFile = document.getElementById("uploadedFile");
		    var formObj = $(this);//.serializeArray();
		    var formURL = formObj.attr("action");					 
		    var formData = new FormData(this);
// 		    alert($("#uploadedFileForo").val());
		    $.ajax({
		        url: formURL,
		    	type: 'POST',
		        data:  formData,
// 				data : {
// 					uplFileName : $("#uploadedFile").val(),
// 				},
		    	mimeType:"multipart/form-data",
		    	contentType: false,
		    	cache: false,
		    	processData:false,
		    	success: function(html)//function(data, textStatus, jqXHR)
		    	{
//		    		$('#listFilesCop').html(html);
		    	},
		     	error: function(xhr, ajaxOptions, errorThrown)
		     	{
		    	 	alert('ups! ' + errorThrown);
		     	}         
		    });
		    e.preventDefault(); //Prevent Default action.
		    e.unbind();
		});
//			$("#upload").submit(); //Submit the form

jQuery(document).ready(function() {
	$('#saveComent').click(function() {
			$.ajax({
				url : 'insertComment', // action to be perform 
				type : 'POST',
				data : {
					
					reply : $('#txtAreaComm').val(),

				},
				dataType : 'html',
				success : function(html) {
					$('#addComment').bPopup().close();
					cargaInfo();
				},
				error : function(xhr, ajaxOptions, thrownError) {
					alert('An error occurred! ' + thrownError);
				},
			});

		});	
});
$("#insertComent").click(function(event) {
	event.preventDefault();
	$("#addComment").slideToggle();
});
var cargaInfo = function() {
	$.ajax({
		url : 'loadTopic', // action to be perform 
		type : 'POST',
// 		data : {
// // 			id : id_Topico
// // 			idForo : id_foro
	
// 		},
		dataType : 'html',
		success : function(html) {
			$('#contenidoInformacion').html(html);
			
		},
		error : function(xhr, ajaxOptions, thrownError) {
			alert('An error occurred! ' + thrownError);
		},
	});
};

</script>	

</head>
<body>

	<button type="submit" class="center btn btn-primary"
												id = "insertComent">
<!-- 												onclick='insertComent();'> -->
												Add Comment</button>
	<div id="addComment" style="display: none;">
		<div>
			<div class="wrapper">
				<h1>Insert Comment</h1>
				<br />
					<textarea id="txtAreaComm" class="txtArea"> </textarea>
					<div>
						<p class="name-help">Please enter your comment.</p>
					</div>			
					<input type="submit" class="submit"  id="saveComent" value="Submit">			
			</div>
		</div>
	</div>
	<div class="clearfix" id="page-wrap">

		<div id="content">
			<section id="main-content" role="main">
				<section id="comments">

					<ol class="commentlist">
						<s:iterator value="comentarios" var="coment">

							<li class="comment even thread-odd thread-alt depth-1"
								id="li-comment-73458">
								<div id="comment-73458">
									<div class="comment-author vcard">
 										
										<cite class="fn"><a href="#" rel="external nofollow"
											class="url"><s:property value="#coment.autor" /></a></cite> <span
											class="says">says:</span>
									</div>
									<!-- .comment-author .vcard -->

<!-- 									<div class="comment-meta commentmetadata"> -->
<%-- 										<a href="#"> 05 <s:property value="mes" /><span>2015</span> --%>
<!-- 										</a> -->
<!-- 									</div> -->
									<!-- .comment-meta .commentmetadata -->

									<div class="comment-body">
										<s:property value="#coment.comentario" />
										<br/>
										<s:if test="#coment.img">
										<a href="#"><img alt="1" src="<s:url value="/imagenescomentarios/%{#coment.url_img}"/>" width="150px" height="150px" onclick="displayImg('<s:url value="/imagenescomentarios/%{#coment.url_img}"/>');"/> </a>
										</s:if>
								
										<br>
										<s:if test="#coment.file">
											<form class="form" method="post" action="downFileForo">
												<s:hidden name="nameFileDownload" value="%{#coment.url_file}" />
												<button type="submit"><img alt="1" src="${pageContext.request.contextPath}/Imagenes/descarga.png" width="30px" height="30px"/></button>
											</form>
										</s:if>

								
									</div>
									<div class="reply" id="rep">
										<div class="repFiles">
										

											<button type="submit" class="center btn btn-primary"
												onclick='popUpFiles("<s:property value="#coment.id_topico" />","<s:property value="#coment.id" />");'>
												Files</button>
												
												
										</div>
										
										
										
										
										
										
										
										<div class="repComment">
											<button type="submit" class="center btn btn-primary"
												onclick='insertReplay("<s:property value="#coment.id_topico" />","<s:property value="#coment.id" />","<s:property value="#coment.idFirstReply" />");'>
												Reply</button>
										</div>									
									</div>									
									<!-- .reply -->
								</div> <!-- #comment-##  --> <s:iterator value="subComentarios"
									var="subcomentario">
									<ol class="children">
										<li
											class="comment byuser comment-author-cssplus-admin bypostauthor odd alt depth-2"
											id="li-comment-72202">
											<div id="comment-72202">
												<div class="comment-author vcard">
													
													<cite class="fn"><a href="#" rel="external nofollow"
														class="url"><s:property value="autor" /></a></cite> <span
														class="says">says:</span>
												</div>
												<!-- .comment-author .vcard -->

<!-- 												<div class="comment-meta commentmetadata"> -->
<!-- 													<a -->
<!-- 														href="http://css-plus.com/2011/07/jquery-if-else-statements/#comment-72202"> -->
<%-- 														18 Feb<span>2014</span> --%>
<!-- 													</a> -->
<!-- 												</div> -->
												<!-- .comment-meta .commentmetadata -->

												<div class="comment-body">
													<s:property value="comentario" />
													<br/>
														<s:if test="#subcomentario.img">
											
															<a href="#"><img alt="1" src="<s:url value="/imagenescomentarios/%{#subcomentario.url_img}"/>" width="150px" height="150px" onclick="displayImg('<s:url value="/imagenescomentarios/%{#subcomentario.url_img}"/>');"/> </a>
														</s:if>
												
														<br>
														<s:if test="#subcomentario.file">
															<form class="form" method="post" action="downFileForo">
																<s:hidden name="nameFileDownload" value="%{#subcomentario.url_file}" />
																<button type="submit"><img alt="1" src="${pageContext.request.contextPath}/Imagenes/descarga.png" width="30px" height="30px"/></button>
															</form>
														</s:if>
												</div>

												<div class="reply" id="rep">
													<div class="repFiles">
														<button type="submit" class="center btn btn-primary"
															onclick='popUpFiles("<s:property value="#subcomentario.id_topico" />","<s:property value="#subcomentario.id" />");'>
															Files</button>
													</div>
													<div class="repComment">
														<button type="submit" 
															class="center btn btn-primary"
															onclick='insertReplay("<s:property value="#subcomentario.id_topico" />","<s:property value="#subcomentario.id" />");'>
															Reply</button>
													</div>


												</div>
												<!-- .reply -->

												<s:iterator value="subComentarios"	var="subcoment">
													<ol class="children">
														<li
															class="comment byuser comment-author-cssplus-admin bypostauthor odd alt depth-2"
															id="li-comment-72202">
															<div id="comment-72202">
																<div class="comment-author vcard">
																	
																	<cite class="fn"><a href="#"
																		rel="external nofollow" class="url"><s:property
																				value="#subcoment.autor" /></a></cite> <span class="says">says:</span>
																</div>
																<!-- .comment-author .vcard -->

<!-- 																<div class="comment-meta commentmetadata"> -->
<!-- 																	<a -->
<!-- 																		href="http://css-plus.com/2011/07/jquery-if-else-statements/#comment-72202"> -->
<%-- 																		18 Feb<span>2014</span> --%>
<!-- 																	</a> -->
<!-- 																</div> -->
																<!-- .comment-meta .commentmetadata -->

																<div class="comment-body">
																	<s:property value="#subcoment.comentario" />
																		<br/>
																		<s:if test="#subcoment.img">
																		
																		<a href="#"><img alt="1" src="<s:url value="/imagenescomentarios/%{#subcoment.url_img}"/>" width="150px" height="150px" onclick="displayImg('<s:url value="/imagenescomentarios/%{#subcoment.url_img}"/>');"/> </a>
																		</s:if>
																
																		<br>
																		<s:if test="#subcoment.file">
																			<form class="form" method="post" action="downFileForo">
																				<s:hidden name="nameFileDownload" value="%{#subcoment.url_file}" />
																				<button type="submit"><img alt="1" src="${pageContext.request.contextPath}/Imagenes/descarga.png" width="30px" height="30px"/></button>
																			</form>
																		</s:if>
																</div>

																<div class="reply" id="rep">
																	<div class="repFiles">
																		<button type="submit" 	class="center btn btn-primary"
																			onclick='popUpFiles("<s:property value="#subcoment.id_topico" />","<s:property value="#subcoment.id" />");'>
																			Files</button>
																	</div>



																</div>
																<!-- .reply -->
															</div> <!-- #comment-##  -->

														</li>
														<!-- #comment-## -->
													</ol>
													<!-- .children -->
												</s:iterator>
											</div> <!-- #comment-##  -->

										</li>
										<!-- #comment-## -->
									</ol>
									<!-- .children -->
								</s:iterator>

							</li>
						</s:iterator>


					</ol>

					<!-- #respond -->
				</section>
			</section>

		</div>
		<!-- /#content -->
	</div>
	<!-- #page-wrap -->	

	<!-- 	div adjuntos -->

	<div id="buscar" class="buscarKN" style="display: none;">
	</div>

	<div id="adjuntos" class="buscarKN" style="display: none;">
		<form id="uploadFileForo" method="post" action="guarda" enctype="multipart/form-data">
			<input id="uploadedFileForo" type="file" name="myFile" multiple />
			<input id="submitButtonForo" type="submit" value="Upload" >
<!-- 			<div id="drop"> -->
<!-- 				Drop Here -->

<!-- 				<a>Browse</a> -->
				
<!-- 			</div> -->

<!-- 			<ul> -->
<!-- 				The file uploads will be shown here -->
<!-- 			</ul> -->

		</form>
	</div>


	
	
	<div id="imagesComment"  style="display: none; height: 485px; width: 640px;">
	<div class="content" style="height: auto; width: auto;">
    
	</div>

	</div>

</body>
</html>
